setClass("VOneParamTestRunner",contains="VTestRunner",
		representation("VIRTUAL",
			.paramSeq="numeric"
		),
		prototype=prototype(
				.description="Virtual One parameter test Runner Class"
		)
)  

#generics
#returns new compList
setGeneric("changeParameters",function(.Object,paramValue,...){standardGeneric("changeParameters")})


#methods
setMethod("initialize",
		signature="VOneParamTestRunner",
		definition=function(.Object,setList, compList, bootstraperPrototype, finalResultComp,scoreObj,
				resultsDirectory,paramSeq,...){
			
			.Object <-callNextMethod(.Object,setList, compList, bootstraperPrototype, finalResultComp,scoreObj,
					resultsDirectory,...);
			.Object@.paramSeq <-paramSeq
			
			return(.Object)
		})

setMethod("runTest",
		signature="VOneParamTestRunner",
		definition=function(.Object,...){
			#the best way to implement it is general algorithm
			#with polymorphic functions
			
			print("runTestStart!!!!!")
			setListLen <-	length(.Object@.setList)
			paramSeqLen <-	length(.Object@.paramSeq)
			compListLen <-	length(.Object@.compList)
			
			
			
			tmpBootstraper <-NULL
			BFResult <- NULL
			print("RUN!")
			for(setN in 1:setListLen){
				print("New Set")
				
				tmpBootstraper <- changeSet(.Object@.bootstraperPrototype,.Object@.setList[[setN]])
				setObj <-list(parSeq=.Object@.paramSeq)
				setObj[["outMatrix"]] <-NULL
				
				
				for(i in 1:paramSeqLen){
					print("New Param")
					#change parameters in list
					.Object@.compList <-changeParameters(.Object,.Object@.paramSeq[i])
					BF <- new("BootstrapFramework", bootstraper=tmpBootstraper,
							scoreObj=.Object@.scoreObj, listComp = .Object@.compList, 
							finalResultProducer = .Object@.finalResultComp)
					
					BFResult <-runFramework(BF)
					setObj[["outMatrix"]] <-cbind(setObj[["outMatrix"]],BFResult$AVGS)
				}	
				#save file for set
				setObj[["ScoreOBJ"]] <- get_description(.Object@.scoreObj)
				setObj[["Name"]] <- .Object@.setList[[setN]]$Name
				result <-setObj
				save(result,file=paste(.Object@.resultsDirectory,"/",.Object@.setList[[setN]]$Name,".rda",sep=""))
			}
			
			#return(.Object)
			return(NULL)
			
			#return(.Object)
		})
